<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>保单详情</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="insPlcBscInfo_form">
    <div class="fieldset1 tabel_col clearFix">
        <div class="caption">
            <span class="title">保单基本信息</span>
        </div>
        <div class="fieldBox col_33">
            <div class="label">保险种类</div>
            <div class="field">
                ${insPlcBscInfoVO.insTypCdNm}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">购买方式</div>
            <div class="field">
                ${insPlcBscInfoVO.buyWayCdNm}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">保单性质</div>
            <div class="field">
                ${insPlcBscInfoVO.plcPropCdNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保单产品类型</div>
            <div class="field">
                ${insPlcBscInfoVO.prdTypCdNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保险公司所属省份</div>
            <div class="field">
                ${insPlcBscInfoVO.rgnPrCdNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保险公司所属城市</div>
            <div class="field">
                ${insPlcBscInfoVO.rgnCyCdNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保险公司</div>
            <div class="field">
                ${insPlcBscInfoVO.insCompNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保险支公司</div>
            <div class="field">
            	${insPlcBscInfoVO.insCompSubNm}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保单号</div>
            <div class="field">
                ${insPlcBscInfoVO.plcNo}
            </div>
        </div>

        <div class="fieldBox col_33">
            <div class="label">保费总金额</div>
            <div class="field">
                ${insPlcBscInfoVO.insTtlFeeDb}
            </div>
        </div>
        <%--<div class="fieldBox col_33">
            <div class="label">保险期限</div>
            <div class="field">
                ${insPlcBscInfoVO.plcExpCdNm}
            </div>
        </div>--%>
        <div class="fieldBox col_33">
            <div class="label">起保时间</div>
            <div class="field">
                ${insPlcBscInfoVO.plcBgTms}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">止保时间</div>
            <div class="field">
                ${insPlcBscInfoVO.plcEndTms}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">被保险人</div>
            <div class="field">
				${insPlcBscInfoVO.insPerNm}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">被保险人证件号码</div>
            <div class="field">
                ${insPlcBscInfoVO.insPerCretNo}
            </div>
        </div>
        <div class="fieldBox col_33">
            <div class="label">第一受益人</div>
            <div class="field">
                ${insPlcBscInfoVO.fstPer}
            </div>
        </div>

        <div class="fieldBox col_100">
            <div class="label">特别说明</div>
            <div class="field">
                ${insPlcBscInfoVO.plcRem}
            </div>
        </div>
        <%--<div class="fieldBox col_100" id="fileModify">
            <div class="label">电子保单</div>
            <div class="field">
                <jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList.jsp" flush="true">
                    <jsp:param name="pkId" value="${insPlcBscInfoVO.id}"/>
                    <jsp:param name="tabNm" value="INS_PLC_BSC_INFO"/>
                </jsp:include>
            </div>
        </div>--%>
    </div>

    <div class="fieldset1 tabel_col tabel_col_s clearFix">
        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>保单附件</span>
            </div>
            <div class="sqPanel_body">
                <div id="plcFileCfgGrid" class="sq-grid"></div>
            </div>
        </div>

        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>保单产品信息</span>
            </div>
            <div class="fieldBox col_100">
                <div id="plcPrdGrid" class="sq-grid"></div>
            </div>
        </div>
    </div>

    <div id="showBtnDiv" class="btnsBox" style="text-align: center;">
        <span id="back_Btn" class="sq-button sq-button-round l-dialog-btn-ok">关闭</span>
        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
    </div>
</form>
<script>
    var plcPrdGrid,plcFileCfgGrid;
    $(function () {
        var insPlcBscInfoId = "${insPlcBscInfoVO.id}";//主键ID
        /*返回*/
        $("#back_Btn").click(function (event) {
            Remove_navTab();
        });

        <c:if test="${colseFlag==1}">
            $('#showBtnDiv').hide();
        </c:if>
        
        //保单产品
        plcPrdGrid = $("#plcPrdGrid").ligerGrid({
            url: '<%=path%>/insurance/insPlcBscInfo/initPlcPrdList.do?prjPrdDtlId=${insPlcBscInfoVO.prjPrdDtlId}&prjId=${insPlcBscInfoVO.prjId}',
            method: 'get',
            columns: [
                {display: '产品名称', name: 'prdNm', minWidth: 100, align: 'center'},
                {display: '产品型号', name: 'prdMdl', width: 100, align: 'left'},
                {display: '厂商', name: 'mfrNm', minWidth: 100, align: 'left'},
                {display: '供应商', name: 'splNm', minWidth: 100, align: 'left'},
                {display: '发动机编号', name: 'engMdl', width: 100, align: 'left'},
                {display: '车架号', name: 'vinNo', width: 100, align: 'left'},
                {display: '底盘号', name: 'chsNo', width: 100, align: 'left'},
                {
                    display: '单价', name: 'prdAmt', width: 90, align: 'right',
                    render: function (rowdata, rowindex, value) {
                        return '&yen;' + FormatMoney(rowdata.prdAmt / 100);
                    }
                },
                {
                    display: '合格证号', name: 'certNo', minWidth: 100, align: 'left',
                    render: function (rowdata, rowindex, value) {
                        if (value) {
                            return '<a href="javascript:;" onclick="detailBtn(' + rowdata.actPrdId + ',' + rowdata.prjPrdDtlId + ')">' + rowdata.certNo + '</a>';
                        }
                    }
                },
                {display: '客户名称', name: 'cstNm', width: 100, align: 'left'},
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            allowUnSelectRow: true,
            alternatingRow: false
        });

        //保单附件
        plcFileCfgGrid = $("#plcFileCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjFileCfgInfo/initInsPlcFileInfoList.do?isShowSts=1&plcId=${insPlcBscInfoVO.id}&prjId=${insPlcBscInfoVO.prjId}',
            <%--url: '<%=path%>/insurance/insPlcBscInfo/initPlcCfgFileList.do',--%>
            method: 'get',
            <%--parms:{"id":"${insPlcBscInfoVO.id}","cfgCd":"INS002,PRJ018","buOrgCd":("${insPlcBscInfoVO.buOrgCd}"=="00000008")?"0000":"${insPlcBscInfoVO.buOrgCd}"},--%>
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function (){
                $('#insFileInfoCfgGrid').rowspan('datNm');
                // $('#insFileInfoCfgGrid').rowspan('uploadNm');
            },
        });

    });

    function getUlFileRecDelColumn(){}

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    /**
     * 格式化金额
     */
    function formatCurrency(num) {
        if (!num) return "0.00";
        num = num.toString().replace(/\$|\,/g, '');
        if (isNaN(num))
            num = "0.00";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num * 100 + 0.50000000001);
        cents = num % 100;
        num = Math.floor(num / 100).toString();
        if (cents < 10)
            cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
            num = num.substring(0, num.length - (4 * i + 3)) + ',' +
                    num.substring(num.length - (4 * i + 3));
        return (((sign) ? '' : '-') + '' + num + '.' + cents);
    }
    //合格证详情
    function detailBtn(id,dtlId){
        var prjId = '${prjId}';
        var paySchNo = '${paySchNo}';
        Add_navTab('tab_prj_prd_veh_info_detail'+id,'合格证详情','<%=path%>/project/prjprdvehinfo/toDetailPage.do?detailFlag=true&&id='+id+'&&dtlId='+dtlId
            + '&&prjId=' + prjId + '&&paySchNo=' + paySchNo);
    }

    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }
</script>
</body>
</html>
